<!-- 项目管理 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label mb10">重点企业</p>
    <dxtable :dataJson="dataJson" :portUrl="portUrl" sonRouter="codeGeneration" :qx="qx" ref="databale" :czFun="czFun">
    </dxtable>
  </div>
</template>
<script lang='ts' setup>
import dxtable from "../../../components/util/dxtable.vue";
import sort from "../../../components/util/sort.vue";
import { dxget, dxpost } from "../../../util/index";
import { NButton, NImage, NTag } from "naive-ui"
import { h, ref, reactive } from "vue";
const databale = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
let dataJson = [

  {
    "title": "页面名称",
    "type": "input",
    "val": "",
    "search": true,
    "icon": "dx-shurukuang", "span": 12, "key": "name", "width": "",
    "istable": true, "required": false
  },
  {
    "title": "apiurl", "type": "input", "val": "", "icon": "dx-shurukuang", "span": 12,
    "key": "apiurl", "width": "", "search": true, "istable": true, "required": false
  }, { "title": "路由名称", "type": "input", "val": "", "icon": "dx-shurukuang",
   "span": 12, "key": "lyname", "width": "", "search": true, "istable": true, "required": false },
  {
    title: "排序",
    width: 100,
    render(row) {
      row.sjk = "xtgx" //数据库
      row.databaseName = "keyEnterprise"; //表名
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: 150,
  },
];
const qx = {
  DeletePermissionID: "codeGenerationlistdel", //删除
  EditPermissionIdentifier: "codeGenerationlistbj", // 编辑
  NewPermissionIdentifier: "codeGenerationlistxz", // 新建
  ViewPermissionID: "codeGenerationlistck", // 查看
};
const portUrl = "dxgjAdmin/dxgjddm";

let formJson = reactive([
  { "title": "页面名称", "type": "input", "val": "", "icon": "dx-shurukuang", "span": 12, "key": "name", "width": "", "search": false, "istable": true, "required": false }, { "title": "apiurl", "type": "input", "val": "", "icon": "dx-shurukuang", "span": 12, "key": "api名称", "width": "", "search": false, "istable": true, "required": false }, { "title": "路由名称", "type": "input", "val": "", "icon": "dx-shurukuang", "span": 12, "key": "lyname", "width": "", "search": false, "istable": true, "required": false }

]);



const czFun = {
  fun: (row) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {
            const { data } = await dxget("dxgjAdmin/api/getcode?id=" + row.id)

            navigator.clipboard.writeText(data)
            window.$message.success("复制成功")
          },
        },
        "复制代码"
      )

    ];
  },
};


// 获取字典内容
// const xtgxxmfl = async () => {
//   const { data }: any = await dxget("dxgjAdmin/getzd", { name: 'xtgxxmfl' })
//   dataJson[2].options = [
//     {
//       label: "全部",
//       value: ""
//     },
//     ...data
//   ]
//   formJson[2].options = data
//   xmlxSelect.value = data
//   console.log(data);
// }
// xtgxxmfl()


</script>
<style scoped></style>